document.addEventListener('DOMContentLoaded', function() {
    // 获取所有进度条
    const bars = document.querySelectorAll('.bar-fill');
    
    // 为每个进度条设置宽度和百分比位置
    bars.forEach(bar => {
        const width = bar.style.width;
        const percent = parseInt(width);
        // 设置CSS变量用于定位百分比标签
        bar.style.setProperty('--percent', width);
        
        // 获取对应的百分比标签
        const percentageLabel = bar.nextElementSibling;
        
        // 处理边界情况
        if (percent <= 10) {
            percentageLabel.style.left = '20px';
            percentageLabel.style.transform = 'translateX(0)';
        } else if (percent >= 90) {
            percentageLabel.style.left = 'calc(100% - 40px)';
            percentageLabel.style.transform = 'translateX(0)';
        }
    });
}); 